package Internet.Test;

import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.net.ServerSocket;
import java.net.Socket;
import java.util.Scanner;

public class Send {
    public static void main(String[] args) throws IOException {
        Socket socket = new Socket("127.0.0.1", 10000);
        OutputStream outputStream = socket.getOutputStream();
        String message = "见到你很开心！";
        outputStream.write(message.getBytes());
        socket.shutdownOutput();

        InputStream inputStream = socket.getInputStream();
        InputStreamReader isr = new InputStreamReader(inputStream);
        int b;
        while ((b = isr.read()) != -1){
            System.out.print((char) b);
        }

        socket.close();
    }
}
